package com.sxpcwlkj.framework.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sxpcwlkj.framework.entity.page.PageRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 基础实体类
 *
 * @name: BaseEntity
 * @author: 西决
 * @date: 2022/12/01
 **/
@EqualsAndHashCode(callSuper = true)
@Data
public class BaseEntity extends PageRequest implements Serializable  {
    private static final long serialVersionUID = 1L;

    /** 状态 */
    @TableField(fill = FieldFill.INSERT)
    private Integer status ;

    /** 排序 */
    @TableField(fill = FieldFill.INSERT)
    private Integer sort ;

    /** 备注 */
    @TableField(fill = FieldFill.INSERT)
    private String remark ;

    /**租户号**/
    @TableField(fill = FieldFill.INSERT)
    private String tenantId ;

    /** 乐观锁 */
    @TableField(fill = FieldFill.INSERT)
    private String revision ;

    /**
     * 创建者
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    /**
     * 更新者
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updatedBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    /**
     * 搜索值
     */
    @JsonIgnore
    @TableField(exist = false)
    private String searchValue;

    /**
     * 请求参数
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();
}
